import { _decorator, Component, input, instantiate, Label, Node, toDegree, Vec3 } from 'cc';
import EventManager from '../Global/EventManager';
import { EventEnum } from '../Enum';
import { IPlayer } from '../Common';
import DataManager from '../Global/DataManager';

const { ccclass, property } = _decorator;

@ccclass('PlayerManager')
export class PlayerManager extends Component {
    init({id,rid,nickname}:IPlayer){
        console.log("当前玩家", {id,rid,nickname});
        const label=this.node.getComponent(Label);
        if(id==DataManager.Instance.myPlayerId){
            label.string=`玩家(我):${nickname}`;
        }
        else {
            label.string=`玩家:${nickname}`;
        }
        this.node.active=true;
    }
  
}

